package com.lv.dao;

import com.lv.bean.Station;
import com.lv.utils.BaseUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.util.List;

public class StationDaoImpl implements StationDao {
    @Override
    public List<Station> selectStationOfCityId(String c_id) {
        //创建QueryRunner
        QueryRunner qr=BaseUtils.getQueryRunner();
        try {
             String sql="select * from station where c_id="+c_id;
            //第一个参数是传来的sql，第二个是实现实体类的设置，第三个是集合转化为数组
            return qr.query(sql, new BeanListHandler<>(Station.class));

        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }
}
